package com.example.springboot.demo;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping(value = "/girl")
public class GirlController {

    @Autowired
    private GirlRepository girlRepository;
    @Autowired
    private GirlService girlService;

    @GetMapping(value = "/insertGirl")
    public void insertGirl(@RequestParam(value = "age", required = false, defaultValue = "0") Integer age
            , @RequestParam(value = "cupSize", required = false, defaultValue = "B") String cupSize) {
        Girl girl = new Girl();
        girl.setAge(age);
        girl.setCupSize(cupSize);
        girlRepository.save(girl);
    }

    @GetMapping(value = "/getAll")
    public List<Girl> getAllGirl() {
        return girlRepository.findAll();
    }

    @GetMapping(value = "/insertTwo")
    public void insertTwo() {
        girlService.insertTwo();
    }


}
